<!--
-File         $Id: AppendixF-FileFormats.html 1102 2011-05-18 18:17:48Z mrook $
-License      GNU FDL (http://www.gnu.org/copyleft/fdl.html)
-Copyright    2002, turing
-Author       alex black, enigma@turingstudio.com
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Phing Guide - File Formats</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="Stylesheet" rev="Stylesheet"
	href="../../css/Documentation.css" type="text/css" media="All"
	charset="iso-8859-1" />
</head>
<body>

	<h1>
		<a name="AppendixFFileFormats"></a>Appendix F: File Formats
	</h1>

	<h2>
		<a name="BuildFileFormat"></a>Build File Format
	</h2>

	<p>
		The following XML file shows a basic Phing build file skeleton that
		can be used as a starting point for your own build files. See the
		references in <a href="AppendixA-FactSheet.html#BuildInProperties">Appendix
			A</a> and <a href="AppendixB-CoreTasks.html">AppendixB</a> for more
		detailed information on properties and tasks.
	</p>

	<pre title="Buildfile format">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;

&lt;!-- 
  =========================================================================  
  The root tag of each build file must be a &quot;project&quot; tag.
  =========================================================================
--&gt;
&lt;project name=&quot;(projectname)&quot; [basedir=&quot;(projectbasedir)&quot;]
         [default=&quot;(targetname)&quot;] [description=&quot;(projectdescription)&quot;]&gt;

  &lt;!--
    =========================================================================  
    Inclusion of optional overall project properties. 
    =========================================================================  
  --&gt;
  &lt;property file=&quot;(main property file)&quot; /&gt;

  &lt;!--
    =========================================================================  
     Build file wide properties used in the targets below
    =========================================================================  
  --&gt;

  &lt;!-- Useful to make the current buildtime available as a property --&gt;
  &lt;tstamp&gt;
      &lt;!-- Format is, e.g. Sat, 03 Oct 2009, 16:31 --&gt;
      &lt;format property="buildtime" pattern="%a, %d %b %Y, %H:%M"/&gt;
  &lt;/tstamp&gt;

  &lt;property name=&quot;(first.property1)&quot;  value=&quot;(value1)&quot; override=&quot;true&quot; /&gt;
  &lt;property name=&quot;(second.property2)&quot;  value=&quot;(value2)&quot; override=&quot;true&quot; /&gt;

  &lt;!--
    =========================================================================  
    Type and task calls here, i.e. filesets, patternsets,
    CopyTask calls etc.
    =========================================================================  
  --&gt;
    &lt;!-- Filesets  --&gt;
    &lt;fileset dir="(fileset.directory)" id="(fileset.reference)"&gt;
        &lt;include name="(include.pattern)"/&gt;
    &lt;/fileset&gt;

    &lt;!-- Custom tasks  --&gt;
    &lt;taskdef classname="(task.classname)" name="task.name" /&gt;
    
  &lt;!--
    =========================================================================  
    All target definitions ...
    =========================================================================  
  --&gt;
  &lt;target name=&quot;(targetname)&quot; [depends=&quot;targetname1,targetname2&quot;]
          [if=&quot;(ifproperty)&quot;] [unless=&quot;(unlessproperty)&quot;]&gt;
    &lt;!--
      ----------------------------------------------------------------------
      Type and task calls here, i.e. filesets, patternsets,
      CopyTask calls, etc.
      ----------------------------------------------------------------------
    --&gt;
  &lt;/target&gt;

  &lt;!--
    =========================================================================  
    More targets here
    =========================================================================  
  --&gt;
  &lt;target name=&quot;...&quot; &gt;
    &lt;!--
      ----------------------------------------------------------------------
      Type and task calls here, i.e. filesets, patternsets,
      CopyTask calls, etc.
      ----------------------------------------------------------------------
    --&gt;

  &lt;/target&gt;
&lt;/project&gt;
</pre>
	<p>
		<i><b>Note:</b>
		</i> By convention properties are named in <i>dot</i> notation in Phing
		build files, e.g. <i>ftp.upload</i>, <i>temp.builddir</i> and so on
	</p>

	<h2>
		<a name="PropertyFileFormat"></a>Property File Format
	</h2>

	<p>
		<em>Property Files</em> define properties. Properties are stored in
		key/value pairs and may only contain plain text. The suffix of these
		files should be <em>.properties</em>, the default Property File for a
		Build File is <em>build.properties</em>
	</p>

	<pre>
# Property files contain key/value pairs
key=value

# Property keys may contain alphanumeric chars and colons, but
# not special chars. This way you can create pseudo-namespaces
myapp.window.hsize=300
myapp.window.vsize=200
myapp.window.xpos=10
myapp.window.ypos=100

# You can refer to values of other properties by enclosing their
# keys in &quot;${}&quot;.
text.width=${myapp.window.hsize}

# <em>Everything</em> behind the equal sign is the value, you do
# not have to enclose strings:
text=This is some text, Your OS is ${php.os}

# I guess that is all there is to property files
</pre>

</body>
</html>
